@echo off

REM Change working directory to current folder; required for running from Eclipse.
echo Changing to current folder...
%~d0
CD %~dp0

sqlcmd -Q "USE master"

echo Closing any existing connections
sqlcmd -Q "IF db_id('pit_to_port_test') IS NOT NULL ALTER DATABASE pit_to_port_test SET SINGLE_USER WITH ROLLBACK IMMEDIATE"

echo Dropping the pit_to_port_test database ...
sqlcmd -Q "IF db_id('pit_to_port_test') IS NOT NULL DROP DATABASE pit_to_port_test"

echo Creating the pit_to_port_test database
sqlcmd -Q "CREATE DATABASE pit_to_port_test"

sqlcmd -Q "USE pit_to_port_test"

echo Running db build script...
sqlcmd -d pit_to_port_test -i empty_schema.sql

pause


